<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script type="text/javascript">
        //  1.将map转成对象
// mapset('name','Zoe').set('age',16).set('gender','male') 
// const mapset=new mapset;
function strMapToObj(strMap) {
        let obj = Object.create(null);//创建空的对象
        for (let [k, v] of strMap) {
            obj[k] = v;
        }
        return obj;
    }

    const myMap = new Map()
        .set('name','Zoe')
        .set('age',16)
        .set('gender','male') 
        

    console.log(strMapToObj(myMap)); 

    </script>
</body>
</html>